@@ -1,3 +0,0 @@ |
||
1 |
-cookbook_path ["cookbooks", "site-cookbooks"] |
|
2 |
-role_path "roles" |
|
3 |
-data_bag_path "data_bags" |
@@ -1,11 +0,0 @@ |
||
1 |
-#!/usr/bin/env ruby |
|
2 |
-#^syntax detection |
|
3 |
- |
|
4 |
-site 'http://community.opscode.com/api/v1' |
|
5 |
- |
|
6 |
-cookbook 'ark' |
|
7 |
-cookbook 'runit' |
|
8 |
-cookbook 'git', :git => 'git://github.com/opscode-cookbooks/git.git' |
|
9 |
-cookbook 'nginx', :git => 'git://github.com/opscode-cookbooks/nginx.git' |
|
10 |
-cookbook 'mysql', :git => 'git://github.com/opscode-cookbooks/mysql.git' |
|
11 |
-cookbook 'nodejs', :git => 'git://github.com/redguide/nodejs.git' |
@@ -1,71 +0,0 @@ |
||
1 |
-SITE |
|
2 |
- remote: http://community.opscode.com/api/v1 |
|
3 |
- specs: |
|
4 |
- apt (2.4.0) |
|
5 |
- bluepill (2.3.1) |
|
6 |
- rsyslog (>= 0.0.0) |
|
7 |
- build-essential (2.0.2) |
|
8 |
- chef_handler (1.1.6) |
|
9 |
- dmg (2.2.0) |
|
10 |
- ohai (2.0.0) |
|
11 |
- rsyslog (1.12.2) |
|
12 |
- runit (1.5.10) |
|
13 |
- build-essential (>= 0.0.0) |
|
14 |
- yum (~> 3.0) |
|
15 |
- yum-epel (>= 0.0.0) |
|
16 |
- windows (1.31.0) |
|
17 |
- chef_handler (>= 0.0.0) |
|
18 |
- yum (3.2.0) |
|
19 |
- yum-epel (0.3.6) |
|
20 |
- yum (~> 3.0) |
|
21 |
- |
|
22 |
-GIT |
|
23 |
- remote: git://github.com/redguide/nodejs.git |
|
24 |
- ref: master |
|
25 |
- sha: 91d8d11f189d13815d56af5700168e1cad88ae7f |
|
26 |
- specs: |
|
27 |
- nodejs (1.3.0) |
|
28 |
- apt (>= 0.0.0) |
|
29 |
- build-essential (>= 0.0.0) |
|
30 |
- yum-epel (>= 0.0.0) |
|
31 |
- |
|
32 |
-GIT |
|
33 |
- remote: git://github.com/opscode-cookbooks/git.git |
|
34 |
- ref: master |
|
35 |
- sha: b1bca76aaf3a3a2131744f17f6e5087e22fa3c40 |
|
36 |
- specs: |
|
37 |
- git (4.0.3) |
|
38 |
- build-essential (>= 0.0.0) |
|
39 |
- dmg (>= 0.0.0) |
|
40 |
- runit (>= 1.0) |
|
41 |
- windows (>= 0.0.0) |
|
42 |
- yum (~> 3.0) |
|
43 |
- yum-epel (>= 0.0.0) |
|
44 |
- |
|
45 |
-GIT |
|
46 |
- remote: git://github.com/opscode-cookbooks/mysql.git |
|
47 |
- ref: master |
|
48 |
- sha: 4b70e99730ab4a7ce6c1dd7a35654a764fb6e0fe |
|
49 |
- specs: |
|
50 |
- mysql (5.2.13) |
|
51 |
- |
|
52 |
-GIT |
|
53 |
- remote: git://github.com/opscode-cookbooks/nginx.git |
|
54 |
- ref: master |
|
55 |
- sha: 45588ee2a5c7144a0ef2a5992e7f273542236d27 |
|
56 |
- specs: |
|
57 |
- nginx (2.7.3) |
|
58 |
- apt (~> 2.2) |
|
59 |
- bluepill (~> 2.3) |
|
60 |
- build-essential (~> 2.0) |
|
61 |
- ohai (~> 2.0) |
|
62 |
- runit (~> 1.2) |
|
63 |
- yum-epel (~> 0.3) |
|
64 |
- |
|
65 |
-DEPENDENCIES |
|
66 |
- git (>= 0) |
|
67 |
- mysql (>= 0) |
|
68 |
- nginx (>= 0) |
|
69 |
- nodejs (>= 0) |
|
70 |
- runit (>= 0) |
|
71 |
- |
@@ -1,40 +0,0 @@ |
||
1 |
-# -*- mode: ruby -*- |
|
2 |
-# vi: set ft=ruby : |
|
3 |
- |
|
4 |
-Vagrant.configure("2") do |config| |
|
5 |
- config.omnibus.chef_version = :latest |
|
6 |
- |
|
7 |
- config.vm.provision :chef_solo do |chef| |
|
8 |
- chef.roles_path = "roles" |
|
9 |
- chef.cookbooks_path = ["cookbooks", "site-cookbooks"] |
|
10 |
- chef.add_role("huginn_development") |
|
11 |
- # chef.add_role("huginn_production") |
|
12 |
- end |
|
13 |
- |
|
14 |
- config.vm.provider :virtualbox do |vb, override| |
|
15 |
- #vb.memory = 1024 |
|
16 |
- #vb.cpus = 4 |
|
17 |
- override.vm.box = "hashicorp/precise64" |
|
18 |
- override.vm.network :forwarded_port, host: 3000, guest: 3000 |
|
19 |
- end |
|
20 |
- |
|
21 |
- config.vm.provider :parallels do |prl, override| |
|
22 |
- override.vm.box = "parallels/ubuntu-12.04" |
|
23 |
- end |
|
24 |
- |
|
25 |
- config.vm.provider :aws do |aws, override| |
|
26 |
- aws.ami = ENV['AWS_AMI'] || "ami-828675f5" |
|
27 |
- aws.region = ENV['AWS_REGION'] || "eu-west-1" |
|
28 |
- aws.instance_type = "t1.micro" |
|
29 |
- |
|
30 |
- override.vm.box = "dummy" |
|
31 |
- override.vm.box_url = "https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box" |
|
32 |
- override.ssh.private_key_path = ENV["AWS_SSH_PRIVKEY"] |
|
33 |
- override.ssh.username = ENV['AWS_SSH_USER'] || "ubuntu" |
|
34 |
- |
|
35 |
- aws.access_key_id = ENV["AWS_ACCESS_KEY_ID"] |
|
36 |
- aws.secret_access_key = ENV["AWS_SECRET_ACCESS_KEY"] |
|
37 |
- aws.keypair_name = ENV["AWS_KEYPAIR_NAME"] |
|
38 |
- aws.security_groups = [ ENV["AWS_SECURITY_GROUP"] ] |
|
39 |
- end |
|
40 |
-end |
@@ -1,30 +0,0 @@ |
||
1 |
-{ |
|
2 |
- |
|
3 |
-"name" : "huginn_development", |
|
4 |
- |
|
5 |
-"chef_type" : "role", |
|
6 |
- |
|
7 |
-"json_class" : "Chef::Role", |
|
8 |
- |
|
9 |
-"description" : "Huginn Development Environment", |
|
10 |
- |
|
11 |
-"default_attributes" : { |
|
12 |
- "mysql" : { |
|
13 |
- "server_root_password" : "", |
|
14 |
- "server_repl_password" : "", |
|
15 |
- "server_debian_password" : "" |
|
16 |
- }, |
|
17 |
- "nginx" : { |
|
18 |
- "init_style" : "upstart" |
|
19 |
- } |
|
20 |
-}, |
|
21 |
- |
|
22 |
-"run_list":[ |
|
23 |
- "recipe[git]", |
|
24 |
- "recipe[apt]", |
|
25 |
- "recipe[mysql::server]", |
|
26 |
- "recipe[mysql::client]", |
|
27 |
- "recipe[nodejs::nodejs_from_binary]", |
|
28 |
- "recipe[huginn_development]" |
|
29 |
- ] |
|
30 |
-} |
@@ -1,30 +0,0 @@ |
||
1 |
-{ |
|
2 |
- |
|
3 |
-"name" : "huginn_production", |
|
4 |
- |
|
5 |
-"chef_type" : "role", |
|
6 |
- |
|
7 |
-"json_class" : "Chef::Role", |
|
8 |
- |
|
9 |
-"description" : "Huginn Production Environment", |
|
10 |
- |
|
11 |
-"default_attributes" : { |
|
12 |
- "mysql": { |
|
13 |
- "server_root_password": "password", |
|
14 |
- "server_repl_password": "", |
|
15 |
- "server_debian_password": "" |
|
16 |
- }, |
|
17 |
- "nginx" : { |
|
18 |
- "init_style" : "upstart" |
|
19 |
- } |
|
20 |
-}, |
|
21 |
- |
|
22 |
-"run_list":[ |
|
23 |
- "recipe[git]", |
|
24 |
- "recipe[apt]", |
|
25 |
- "recipe[mysql::server]", |
|
26 |
- "recipe[nodejs::nodejs_from_binary]", |
|
27 |
- "recipe[nginx]", |
|
28 |
- "recipe[huginn_production]" |
|
29 |
- ] |
|
30 |
-} |
@@ -1,78 +0,0 @@ |
||
1 |
-include_recipe 'apt' |
|
2 |
-include_recipe 'build-essential' |
|
3 |
- |
|
4 |
-user "huginn" do |
|
5 |
- action :create |
|
6 |
- system true |
|
7 |
- home "/home/huginn" |
|
8 |
- password "$6$ZwO6b.6tij$SMa8UIwtESGDxB37NwHsct.gJfXWmmflNbH.oypwJ9y0KkzMkCdw7D14iK7GX9C4CWSEcpGOFUow7p01rQFu5." |
|
9 |
- supports :manage_home => true |
|
10 |
- gid "sudo" |
|
11 |
- shell "/bin/bash" |
|
12 |
-end |
|
13 |
- |
|
14 |
-group "huginn" do |
|
15 |
- members ["huginn"] |
|
16 |
- action :create |
|
17 |
-end |
|
18 |
- |
|
19 |
-%w("ruby1.9.1" "ruby1.9.1-dev" "libxslt-dev" "libxml2-dev" "curl" "libmysqlclient-dev" "libffi-dev" "libssl-dev").each do |pkg| |
|
20 |
- package pkg do |
|
21 |
- action :install |
|
22 |
- end |
|
23 |
-end |
|
24 |
- |
|
25 |
-bash "Setting default ruby and gem versions to 1.9" do |
|
26 |
- code <<-EOH |
|
27 |
- if [ $(readlink /usr/bin/ruby) != "ruby1.9.1" ] |
|
28 |
- then |
|
29 |
- update-alternatives --set ruby /usr/bin/ruby1.9.1 |
|
30 |
- fi |
|
31 |
- |
|
32 |
- if [ $(readlink /usr/bin/gem) != "gem1.9.1" ] |
|
33 |
- then |
|
34 |
- update-alternatives --set gem /usr/bin/gem1.9.1 |
|
35 |
- fi |
|
36 |
- EOH |
|
37 |
-end |
|
38 |
- |
|
39 |
-git "/home/huginn/huginn" do |
|
40 |
- repository 'git://github.com/cantino/huginn.git' |
|
41 |
- reference 'master' |
|
42 |
- action :sync |
|
43 |
- user "huginn" |
|
44 |
-end |
|
45 |
- |
|
46 |
-gem_package("rake") |
|
47 |
-gem_package("bundle") |
|
48 |
- |
|
49 |
-bash "Setting huginn user with NOPASSWD option" do |
|
50 |
- cwd "/etc/sudoers.d" |
|
51 |
- code <<-EOH |
|
52 |
- touch huginn |
|
53 |
- chmod 0440 huginn |
|
54 |
- echo "huginn ALL=(ALL) NOPASSWD:ALL" >> huginn |
|
55 |
- EOH |
|
56 |
-end |
|
57 |
- |
|
58 |
-bash "huginn dependencies" do |
|
59 |
- user "huginn" |
|
60 |
- cwd "/home/huginn/huginn" |
|
61 |
- code <<-EOH |
|
62 |
- export LANG="en_US.UTF-8" |
|
63 |
- export LC_ALL="en_US.UTF-8" |
|
64 |
- sudo bundle install |
|
65 |
- sed s/REPLACE_ME_NOW\!/$(sudo bundle exec rake secret)/ .env.example > .env |
|
66 |
- sudo bundle exec rake db:create |
|
67 |
- sudo bundle exec rake db:migrate |
|
68 |
- sudo bundle exec rake db:seed |
|
69 |
- EOH |
|
70 |
-end |
|
71 |
- |
|
72 |
-bash "huginn has been installed and will start in a minute" do |
|
73 |
- user "huginn" |
|
74 |
- cwd "/home/huginn/huginn" |
|
75 |
- code <<-EOH |
|
76 |
- sudo nohup foreman start & |
|
77 |
- EOH |
|
78 |
-end |
@@ -1,2 +0,0 @@ |
||
1 |
-web: sudo bundle exec unicorn_rails -c config/unicorn.rb -E production |
|
2 |
-jobs: sudo RAILS_ENV=production bundle exec rails runner bin/threaded.rb |
@@ -1,110 +0,0 @@ |
||
1 |
-# ==== Required configuration settings for Huginn ==== |
|
2 |
- |
|
3 |
-# Replace the following with the output from "rake secret" |
|
4 |
-APP_SECRET_TOKEN=REPLACE_ME_NOW! |
|
5 |
- |
|
6 |
-# This is the domain where your Huginn instance will be running. The default should work |
|
7 |
-# for development, but it needs to be changed to your Huginn domain when you deploy to a |
|
8 |
-# production environment (e.g., yourdomain.com, possibly including a port). |
|
9 |
-#DOMAIN=localhost:3000 |
|
10 |
- |
|
11 |
-############################ |
|
12 |
-# Database Setup # |
|
13 |
-############################ |
|
14 |
- |
|
15 |
-DATABASE_ADAPTER=mysql2 |
|
16 |
-DATABASE_ENCODING=utf8 |
|
17 |
-DATABASE_RECONNECT=true |
|
18 |
-DATABASE_NAME=huginn_production |
|
19 |
-DATABASE_POOL=5 |
|
20 |
-DATABASE_USERNAME=root |
|
21 |
-DATABASE_PASSWORD=password |
|
22 |
-#DATABASE_HOST=your-domain-here.com |
|
23 |
-#DATABASE_PORT=3306 |
|
24 |
-#DATABASE_SOCKET=/tmp/mysql.sock |
|
25 |
- |
|
26 |
-# ==== Additional required production settings ==== |
|
27 |
- |
|
28 |
-# Configure Rails environment. This should only be needed in production and may cause errors in development. |
|
29 |
-RAILS_ENV=production |
|
30 |
- |
|
31 |
-# Should Rails force all requests to use SSL? |
|
32 |
-FORCE_SSL=false |
|
33 |
- |
|
34 |
-############################ |
|
35 |
-# Allowing Signups # |
|
36 |
-############################ |
|
37 |
- |
|
38 |
-# This invitation code will be required for users to signup with your Huginn installation. |
|
39 |
-# You can see its use in user.rb. PLEASE CHANGE THIS! |
|
40 |
-INVITATION_CODE=try-huginn |
|
41 |
- |
|
42 |
-# If you don't want to require users to have an invitation code, set this to true |
|
43 |
-SKIP_INVITATION_CODE=false |
|
44 |
- |
|
45 |
-############################# |
|
46 |
-# Email Configuration # |
|
47 |
-############################# |
|
48 |
- |
|
49 |
-# Outgoing email settings. To use Gmail or Google Apps, put your Google Apps domain or gmail.com |
|
50 |
-# as the SMTP_DOMAIN and your Gmail username and password as the SMTP_USER_NAME and SMTP_PASSWORD. |
|
51 |
-# |
|
52 |
-# PLEASE NOTE: In order to enable sending real emails via SMTP locally (e.g., when not in the production Rails environment), |
|
53 |
-# you must also set SEND_EMAIL_IN_DEVELOPMENT to true below. |
|
54 |
- |
|
55 |
-SMTP_DOMAIN=your-domain-here.com |
|
56 |
-SMTP_USER_NAME=you@gmail.com |
|
57 |
-SMTP_PASSWORD=somepassword |
|
58 |
-SMTP_SERVER=smtp.gmail.com |
|
59 |
-SMTP_PORT=587 |
|
60 |
-SMTP_AUTHENTICATION=plain |
|
61 |
-SMTP_ENABLE_STARTTLS_AUTO=true |
|
62 |
- |
|
63 |
-# Set to true to send real emails via SMTP when running in the development Rails environment. |
|
64 |
-# Set to false to have emails intercepted in development and displayed at http://localhost:3000/letter_opener |
|
65 |
-SEND_EMAIL_IN_DEVELOPMENT=false |
|
66 |
- |
|
67 |
-# The address from which system emails will appear to be sent. |
|
68 |
-EMAIL_FROM_ADDRESS=from_address@gmail.com |
|
69 |
- |
|
70 |
-########################### |
|
71 |
-# Agent Logging # |
|
72 |
-########################### |
|
73 |
- |
|
74 |
-# Number of lines of log messages to keep per Agent |
|
75 |
-AGENT_LOG_LENGTH=200 |
|
76 |
- |
|
77 |
-############################# |
|
78 |
-# AWS and Mechanical Turk # |
|
79 |
-############################# |
|
80 |
- |
|
81 |
-# AWS Credentials for MTurk |
|
82 |
-AWS_ACCESS_KEY_ID=YOUR-AWS-ACCESS-KEY-ID |
|
83 |
-AWS_ACCESS_KEY=YOUR-AWS-ACCESS-KEY |
|
84 |
- |
|
85 |
-# Set AWS_SANDBOX to true if you're developing Huginn code. |
|
86 |
-AWS_SANDBOX=false |
|
87 |
- |
|
88 |
-######################## |
|
89 |
-# Various Settings # |
|
90 |
-######################## |
|
91 |
- |
|
92 |
-# Specify the HTTP backend library for Faraday, used in WebsiteAgent. |
|
93 |
-# You can change this depending on the performance and stability you |
|
94 |
-# need for your service. Any choice other than "typhoeus", |
|
95 |
-# "net_http", or "em_http" should require you to bundle a corresponding |
|
96 |
-# gem via Gemfile. |
|
97 |
-FARADAY_HTTP_BACKEND=typhoeus |
|
98 |
- |
|
99 |
-# Allow JSONPath eval expresions. i.e., $..price[?(@ < 20)] |
|
100 |
-# You should not allow this on a shared Huginn box because it is not secure. |
|
101 |
-ALLOW_JSONPATH_EVAL=false |
|
102 |
- |
|
103 |
-# Enable this setting to allow insecure Agents like the ShellCommandAgent. Only do this |
|
104 |
-# when you trust everyone using your Huginn installation. |
|
105 |
-ENABLE_INSECURE_AGENTS=false |
|
106 |
- |
|
107 |
-# Use Graphviz for generating diagrams instead of using Google Chart |
|
108 |
-# Tools. Specify a dot(1) command path built with SVG support |
|
109 |
-# enabled. |
|
110 |
-#USE_GRAPHVIZ_DOT=dot |
@@ -1,36 +0,0 @@ |
||
1 |
-#worker_process 2; |
|
2 |
-user huginn huginn; |
|
3 |
- |
|
4 |
-events { |
|
5 |
- worker_connections 1024; |
|
6 |
- accept_mutex on; |
|
7 |
-} |
|
8 |
- |
|
9 |
-http { |
|
10 |
- types_hash_max_size 2048; |
|
11 |
- include mime.types; |
|
12 |
- |
|
13 |
- upstream huginn_server { |
|
14 |
- server unix:/home/huginn/shared/tmp/sockets/unicorn.sock; |
|
15 |
- } |
|
16 |
- |
|
17 |
- server { |
|
18 |
- listen 80; |
|
19 |
- server_name _; |
|
20 |
- keepalive_timeout 5; |
|
21 |
- root /home/huginn/current/public; |
|
22 |
- try_files $uri/index.html $uri.html $uri @app; |
|
23 |
- error_page 500 502 503 504 /500.html; |
|
24 |
- location = /500.html { |
|
25 |
- root /home/huginn/current/public; |
|
26 |
- } |
|
27 |
- location @app { |
|
28 |
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
|
29 |
- proxy_set_header X-Forwarded-Proto $scheme; |
|
30 |
- proxy_set_header Host $http_host; |
|
31 |
- proxy_redirect off; |
|
32 |
- proxy_pass http://huginn_server; |
|
33 |
- } |
|
34 |
-} |
|
35 |
-} |
|
36 |
- |
@@ -1,35 +0,0 @@ |
||
1 |
-app_path = "/home/huginn/current" |
|
2 |
- |
|
3 |
-worker_processes 2 |
|
4 |
-preload_app true |
|
5 |
-timeout 180 |
|
6 |
-listen '/home/huginn/shared/tmp/sockets/unicorn.sock' |
|
7 |
- |
|
8 |
-working_directory app_path |
|
9 |
- |
|
10 |
-rails_env = ENV['RAILS_ENV'] || 'production' |
|
11 |
- |
|
12 |
-# Log everything to one file |
|
13 |
-stderr_path "log/unicorn_out.log" |
|
14 |
-stdout_path "log/unicorn_err.log" |
|
15 |
- |
|
16 |
-# Set master PID location |
|
17 |
-pid '/home/huginn/shared/tmp/pids/unicorn.pid' |
|
18 |
- |
|
19 |
-before_fork do |server, worker| |
|
20 |
- defined?(ActiveRecord::Base) and |
|
21 |
- ActiveRecord::Base.connection.disconnect! |
|
22 |
- old_pid = "#{server.config[:pid]}.oldbin" |
|
23 |
- if File.exist?(old_pid) && server.pid != old_pid |
|
24 |
- begin |
|
25 |
- Process.kill("QUIT", File.read(old_pid).to_i) |
|
26 |
- rescue Errno::ENOENT, Errno::ESRCH |
|
27 |
- # someone else did our job for us |
|
28 |
- end |
|
29 |
- end |
|
30 |
-end |
|
31 |
- |
|
32 |
-after_fork do |server, worker| |
|
33 |
- defined?(ActiveRecord::Base) and |
|
34 |
- ActiveRecord::Base.establish_connection |
|
35 |
-end |
@@ -1,111 +0,0 @@ |
||
1 |
-include_recipe 'apt' |
|
2 |
-include_recipe 'build-essential' |
|
3 |
- |
|
4 |
-user "huginn" do |
|
5 |
- system true |
|
6 |
- home "/home/huginn" |
|
7 |
- password "$6$ZwO6b.6tij$SMa8UIwtESGDxB37NwHsct.gJfXWmmflNbH.oypwJ9y0KkzMkCdw7D14iK7GX9C4CWSEcpGOFUow7p01rQFu5." |
|
8 |
- supports :manage_home => true |
|
9 |
- shell "/bin/bash" |
|
10 |
- gid "sudo" |
|
11 |
-end |
|
12 |
- |
|
13 |
-group "huginn" do |
|
14 |
- members ["huginn"] |
|
15 |
-end |
|
16 |
- |
|
17 |
-%w("ruby1.9.1" "ruby1.9.1-dev" "libxslt-dev" "libxml2-dev" "curl" "libmysqlclient-dev" "libffi-dev" "libssl-dev").each do |pkg| |
|
18 |
- package("#{pkg}") |
|
19 |
-end |
|
20 |
- |
|
21 |
-bash "Setting default ruby and gem versions to 1.9" do |
|
22 |
- code <<-EOH |
|
23 |
- if [ $(readlink /usr/bin/ruby) != "ruby1.9.1" ] |
|
24 |
- then |
|
25 |
- update-alternatives --set ruby /usr/bin/ruby1.9.1 |
|
26 |
- fi |
|
27 |
- |
|
28 |
- if [ $(readlink /usr/bin/gem) != "gem1.9.1" ] |
|
29 |
- then |
|
30 |
- update-alternatives --set gem /usr/bin/gem1.9.1 |
|
31 |
- fi |
|
32 |
- EOH |
|
33 |
-end |
|
34 |
- |
|
35 |
-gem_package("rake") |
|
36 |
-gem_package("bundle") |
|
37 |
- |
|
38 |
-service "nginx" do |
|
39 |
- supports :restart => true, :start => true, :stop => true, :reload => true |
|
40 |
- action :nothing |
|
41 |
-end |
|
42 |
- |
|
43 |
-bash "Setting huginn user with NOPASSWD option" do |
|
44 |
- cwd "/etc/sudoers.d" |
|
45 |
- code <<-EOH |
|
46 |
- touch huginn && chmod 0440 huginn |
|
47 |
- echo "huginn ALL=(ALL) NOPASSWD:ALL" >> huginn |
|
48 |
- EOH |
|
49 |
-end |
|
50 |
- |
|
51 |
-deploy "/home/huginn" do |
|
52 |
- repo "https://github.com/cantino/huginn.git" |
|
53 |
- branch "master" |
|
54 |
- user "huginn" |
|
55 |
- group "huginn" |
|
56 |
- environment "RAILS_ENV" => "production" |
|
57 |
- keep_releases 5 |
|
58 |
- create_dirs_before_symlink [] |
|
59 |
- symlinks "log" => "log" |
|
60 |
- symlink_before_migrate({}) |
|
61 |
- rollback_on_error true |
|
62 |
- notifies :enable, "service[nginx]" |
|
63 |
- notifies :start, "service[nginx]" |
|
64 |
- before_symlink do |
|
65 |
- %w(config log tmp).each do |dir| |
|
66 |
- directory "/home/huginn/shared/#{dir}" do |
|
67 |
- owner "huginn" |
|
68 |
- group "huginn" |
|
69 |
- recursive true |
|
70 |
- end |
|
71 |
- end |
|
72 |
- directory("/home/huginn/shared/tmp/pids") |
|
73 |
- directory("/home/huginn/shared/tmp/sockets") |
|
74 |
- %w(Procfile unicorn.rb nginx.conf).each do |file| |
|
75 |
- cookbook_file "/home/huginn/shared/config/#{file}" do |
|
76 |
- owner "huginn" |
|
77 |
- action :create_if_missing |
|
78 |
- end |
|
79 |
- end |
|
80 |
- cookbook_file "home/huginn/shared/config/.env" do |
|
81 |
- source "env.example" |
|
82 |
- mode "666" |
|
83 |
- owner "huginn" |
|
84 |
- action :create_if_missing |
|
85 |
- end |
|
86 |
- end |
|
87 |
- before_restart do |
|
88 |
- bash "huginn dependencies" do |
|
89 |
- cwd "/home/huginn/current" |
|
90 |
- user "huginn" |
|
91 |
- group "huginn" |
|
92 |
- code <<-EOH |
|
93 |
- export LANG="en_US.UTF-8" |
|
94 |
- export LC_ALL="en_US.UTF-8" |
|
95 |
- ln -nfs /home/huginn/shared/config/Procfile ./Procfile |
|
96 |
- ln -nfs /home/huginn/shared/config/.env ./.env |
|
97 |
- ln -nfs /home/huginn/shared/config/unicorn.rb ./config/unicorn.rb |
|
98 |
- sudo cp /home/huginn/shared/config/nginx.conf /etc/nginx/ |
|
99 |
- echo 'gem "unicorn", :group => :production' >> Gemfile |
|
100 |
- sudo bundle install --without=development --without=test |
|
101 |
- sed -i s/REPLACE_ME_NOW\!/$(sudo bundle exec rake secret)/ /home/huginn/shared/config/.env |
|
102 |
- sudo RAILS_ENV=production bundle exec rake db:create |
|
103 |
- sudo RAILS_ENV=production bundle exec rake db:migrate |
|
104 |
- sudo RAILS_ENV=production bundle exec rake db:seed |
|
105 |
- sudo RAILS_ENV=production bundle exec rake assets:precompile |
|
106 |
- sudo foreman export upstart /etc/init -a huginn -u huginn -l log |
|
107 |
- sudo start huginn |
|
108 |
- EOH |
|
109 |
- end |
|
110 |
- end |
|
111 |
-end |